/********************************************************//***** Replication file for Hidalgo et al.,         *****//***** "Economic Determinants *****//***** of Land Invasions," Review of Economics and  *****//***** Statistics, 2010                             *****//********************************************************/clear set mem 100mset matsize 800set more offuse "replication_5-5-10.dta", cleartsset code year, yearly/***** create dummies and interactions *****/sort code yeargen occs_0_1=.replace occs_0_1=0 if occs==0replace occs_0_1=1 if occs>0 & occs!=.xi i.year, prefix(_T)sort codeglobal interactions "land_gini land_polar land_top10pct land_bottom50pct frac_landless frac_rented frac_owned frac_shared log_social_budget log_security_budget mean_gini close unusedland share_pib_nonag frac_ext_pov banks meanrain coefvarrain"foreach l of global interactions {gen `l'_income=`l'*ag_incomegen `l'_rain=`l'*rain_monthlylabel var `l'_income "`l' $ \times$ Agricultural Income"}global triple "frac_rented frac_owned frac_shared"foreach l of global triple {cap gen lg_`l'_income=`l'_income*land_ginicap gen lg_`l'_rain=`l'_rain*land_ginilabel var lg_`l'_income "`l' $ \times$ Land Gini $ \times$ Agricultural Income"}/**************** define global vars **********************/global ifyear="if rain_yearly!=. & ag_income!=."global ifmonth="if rain_monthly!=. & ag_income!=."global if="if logruralpop!=. & rain_monthly!=. & logy!=. & gini!=. & hdi_education!=."/***************** table 1: descriptive *******************/sum rain_yearly $ifyearsum year occs_0_1 occs logfam rain_monthly rain_monthly_sq meanrain sdrain coefvarrain ag_income logpop land_gini land_polar land_top10pct land_bottom50pct frac_landless frac_rented frac_owned frac_shared mean_gini frac_ext_pov share_pib_nonag close unusedland banks log_social_budget log_social_budget $ifmonthsum occs logfam logy unemp rain_monthly logpop gini logruralpop hdi_education $if/********* table 2: first stage *****************/areg ag_income rain_monthly logpop _T*, absorb(code) cluster(code)test rain_monthlyareg ag_income rain_monthly_sq logpop _T*, absorb(code) cluster(code)test rain_monthly_sqareg ag_income rain_yearly logpop _T*, absorb(code) cluster(code)test rain_yearlyareg ag_income rain_monthly future_rain_monthly logpop _T*, absorb(code) cluster(code)test rain_monthly future_rain_monthly/**************** table 3: LPM *********************/areg occs_0_1 ag_income logpop _T* $ifmonth, absorb(code) cluster(code)xtivreg2 occs_0_1 (ag_income=rain_monthly) logpop _T*, cluster(code) fextivreg2 occs_0_1 (ag_income=rain_monthly_sq) logpop _T*, cluster(code) fextivreg2 occs_0_1 (ag_income=rain_yearly) logpop _T*, cluster(code) feareg occs_0_1 rain_monthly logpop _T* $ifmonth, absorb(code) cluster(code)areg occs_0_1 rain_monthly_sq logpop _T* $ifmonth, absorb(code) cluster(code)areg occs_0_1 rain_yearly logpop _T* $ifyear, absorb(code) cluster(code)/**************** table 4a: occs *********************/areg occs ag_income logpop _T* $ifmonth, absorb(code) cluster(code)xtivreg2 occs (ag_income=rain_monthly) logpop _T*, cluster(code) fextivreg2 occs (ag_income=rain_monthly_sq) logpop _T*, cluster(code) fextivreg2 occs (ag_income=rain_yearly) logpop _T*, cluster(code) feareg occs rain_monthly logpop _T* $ifmonth, absorb(code) cluster(code)areg occs rain_monthly_sq logpop _T* $ifmonth, absorb(code) cluster(code)areg occs rain_yearly logpop _T* $ifyear, absorb(code) cluster(code)/**************** table 4b: logfam *********************/areg logfam ag_income logpop _T* $ifmonth, absorb(code) cluster(code)xtivreg2 logfam (ag_income=rain_monthly) logpop _T*, cluster(code) fextivreg2 logfam (ag_income=rain_monthly_sq) logpop _T*, cluster(code) fextivreg2 logfam (ag_income=rain_yearly) logpop _T*, cluster(code) feareg logfam rain_monthly logpop _T* $ifmonth, absorb(code) cluster(code)areg logfam rain_monthly_sq logpop _T* $ifmonth, absorb(code) cluster(code)areg logfam rain_yearly logpop _T* $ifyear, absorb(code) cluster(code)/***************** table 5: using two period income *******************/xtreg occs logy gini logruralpop hdi_education logpop _T* $if, fextreg logy rain_monthly gini logruralpop hdi_education logpop _T* $if, fetest rain_monthlyxtivreg occs (logy = rain_monthly) gini logruralpop hdi_education logpop _T*, fextreg occs unemp gini logruralpop hdi_education logpop _T* $if, fextreg unemp rain_monthly gini logruralpop hdi_education logpop _T* $if, fetest rain_monthlyxtivreg occs (unemp = rain_monthly) gini logruralpop hdi_education logpop _T*, fextreg occs rain_monthly gini logruralpop hdi_education logpop _T* $if, fe /**************** table 6: sum_occs>0 *****************/areg ag_income rain_monthly logpop _T* $ifmonth & sum_occs>0, absorb(code) cluster(code)test rain_monthlyareg occs ag_income logpop _T* $ifmonth & sum_occs>0, absorb(code) cluster(code)xtivreg2 occs (ag_income=rain_monthly) logpop _T* $ifmonth & sum_occs>0, fe cluster(code) areg logfam ag_income logpop _T* $ifmonth & sum_occs>0, absorb(code) cluster(code)xtivreg2 logfam (ag_income=rain_monthly) logpop _T* $ifmonth & sum_occs>0, fe cluster(code) /**************** Table 8: land inequality interactions ******************/xtivreg2 occs (ag_income land_gini_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly land_gini_rain) logpop _T* $ifmonth, fe cluster(code) gmm first savefirst xtivreg2 occs (ag_income land_polar_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly land_polar_rain) logpop _T* $ifmonth, fe cluster(code) gmm first savefirst xtivreg2 occs (ag_income land_gini_income land_polar_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly land_gini_rain land_polar_rain) logpop _T* $ifmonth, fe cluster(code) gmm first savefirst xtivreg2 occs (ag_income land_top10pct_income frac_landless_income land_bottom50pct_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly land_top10pct_rain frac_landless_rain land_bottom50pct_rain) logpop _T* $ifmonth, fe cluster(code) gmm first savefirst xtivreg2 logfam (ag_income land_gini_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly land_gini_rain) logpop _T* $ifmonth, fe cluster(code) gmm first savefirst xtivreg2 logfam (ag_income land_polar_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly land_polar_rain) logpop _T* $ifmonth, fe cluster(code) gmm first savefirst xtivreg2 logfam (ag_income land_gini_income land_polar_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly land_gini_rain land_polar_rain) logpop _T* $ifmonth  & frac_rural>.1, fe cluster(code) gmm first savefirst xtivreg2 logfam (ag_income land_top10pct_income frac_landless_income land_bottom50pct_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly land_top10pct_rain frac_landless_rain land_bottom50pct_rain) logpop _T* $ifmonth, fe cluster(code) gmm first savefirst /**************** Table 9: Land Contracts ***********************************/xtivreg2 occs (ag_income frac_rented_income land_gini_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly frac_rented_rain land_gini_rain) logpop _T*, fe cluster(code) gmm first savefirstxtivreg2 occs (ag_income frac_owned_income land_gini_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly frac_owned_rain land_gini_rain) logpop _T*, fe cluster(code) gmm first savefirstxtivreg2 occs (ag_income frac_shared_income land_gini_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly frac_shared_rain land_gini_rain) logpop _T*, fe cluster(code) gmm first savefirstxtivreg2 occs (ag_income frac_rented_income frac_owned_income frac_shared_income land_gini_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly frac_rented_rain frac_owned_rain frac_shared_rain land_gini_rain) logpop _T*, fe cluster(code) gmm first savefirstxtivreg2 occs (ag_income frac_rented_income land_gini_income lg_frac_rented_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly frac_rented_rain land_gini_rain lg_frac_rented_rain) logpop _T*, fe cluster(code) gmm first savefirstxtivreg2 occs (ag_income frac_owned_income land_gini_income lg_frac_owned_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly frac_owned_rain land_gini_rain lg_frac_owned_rain) logpop _T*, fe cluster(code) gmm first savefirstxtivreg2 occs (ag_income frac_shared_income land_gini_income lg_frac_shared_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly frac_shared_rain land_gini_rain lg_frac_shared_rain) logpop _T*, fe cluster(code) gmm first savefirst/**************** Table 10: other interactions ************/xtivreg2 occs (ag_income log_security_budget_income land_gini_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly log_security_budget_rain land_gini_rain) log_security_budget logpop _T*, fe cluster(code)  gmm savefirstxtivreg2 occs (ag_income log_social_budget_income land_gini_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly log_social_budget_rain land_gini_rain) log_social_budget logpop _T*, fe cluster(code)  gmm savefirstxtivreg2 occs (ag_income banks_income land_gini_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly banks_rain land_gini_rain)  logpop _T*, fe cluster(code)  gmm savefirstxtivreg2 occs (ag_income share_pib_nonag_income land_gini_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly share_pib_nonag_rain land_gini_rain) share_pib_nonag logpop _T*, fe cluster(code)  gmm savefirstxtivreg2 occs (ag_income mean_gini_income land_gini_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly mean_gini_rain land_gini_rain)  logpop _T*, fe cluster(code)  gmm savefirstxtivreg2 occs (ag_income frac_ext_pov_income land_gini_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly frac_ext_pov_rain land_gini_rain)  logpop _T*, fe cluster(code)  gmm savefirstxtivreg2 occs (ag_income unusedland_income land_gini_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly unusedland_rain land_gini_rain)  logpop _T*, fe cluster(code)  gmm savefirstxtivreg2 occs (ag_income close_income land_gini_income meanrain_income coefvarrain_income = meanrain_rain coefvarrain_rain rain_monthly close_rain land_gini_rain) close logpop _T*, fe cluster(code)  gmm savefirst/****** Load cross-section data for tables 7, 11, 12 ******/use "replication_cs_5-5-10.dta", cleardrop if meanrain==.global control="gini ext_pov logpop logruralpop logarea hdi_education"global controls="$control i.microregion"/******** Table 7: Rainfall and land inequality **********/reg landgini meanrain sdrain logy unusedland $controlxi: reg landgini meanrain sdrain logy unusedland $controls, cluster(microregion)reg landgini meanrain coefvarrain logy unusedland $controlxi: reg landgini meanrain coefvarrain logy unusedland $controls, cluster(microregion)reg frac_rented meanrain sdrain logy unusedland $controlxi: reg frac_rented meanrain sdrain logy unusedland $controls, cluster(microregion)reg frac_rented meanrain coefvarrain logy unusedland $controlxi: reg frac_rented meanrain coefvarrain logy unusedland $controls, cluster(microregion)/******** Table 11: Descriptive statistics ****************/ sum occs occs_0_1 logfam landgini frac_rented frac_owned meanrain sdrain coefvarrain logy unusedland $control/******** Table 12: cross-section *************************/reg occs landgini frac_rented frac_owned meanrain coefvarrain logy unusedland $control xi: reg occs landgini frac_rented frac_owned meanrain coefvarrain logy unusedland $controls, cluster(microregion)xi: nbreg occs landgini frac_rented frac_owned meanrain coefvarrain logy unusedland $controls, cluster(microregion) nolrtestxi:reg occs_0_1 landgini frac_rented frac_owned meanrain coefvarrain logy unusedland $controls, cluster(microregion)xi: reg logfam landgini frac_rented frac_owned meanrain coefvarrain logy unusedland $controls, cluster(microregion)